/*
 * PACKAGE NAME: com.jodinfo.outmirror.api.reportrepairbarcode.controller
 * FILE    NAME: ReportRepairBarcodeDaoImpl.java
 * COPYRIGHT: Copyright(c) © 2016 heroj Company Ltd. All Rights Reserved
 */ 
package com.jodinfo.outmirror.api.reportrepairbarcode.controller;

import java.math.BigInteger;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSON;
import com.hero.common.web.context.UserContext;
import com.hero.core.constant.SysConstant;
import com.hero.core.entity.ResponseEntity;
import com.jodinfo.outmirror.api.reportrepairbarcode.entity.ReportRepairBarcodeEntity;
import com.jodinfo.outmirror.api.reportrepairbarcode.service.ReportRepairBarcodeBizService;



@Controller
@RequestMapping(value = "/ReportRepairBarcodeAdmin")
public class ReportRepairBarcodeController  {
	
@Resource(name="reportRepairBarcodeBizService")
private ReportRepairBarcodeBizService ReportRepairBarcodeBizService;
/**
*  list数据源
* 
* */
@RequestMapping(value = "/List")
@ResponseBody
public String ReportRepairBarcodeList(ReportRepairBarcodeEntity ReportRepairBarcodeEntity) {
	if(ReportRepairBarcodeEntity==null){
		ReportRepairBarcodeEntity = new ReportRepairBarcodeEntity();
		ReportRepairBarcodeEntity.setPageIndex(SysConstant.DEFAULT_PAGEINDEX);
		ReportRepairBarcodeEntity.setPageSize(SysConstant.DEFAULT_PAGESIZE);
	}
	ReportRepairBarcodeEntity.setCurrentUser(UserContext.getUser());
	String str = ReportRepairBarcodeBizService.queryListForPageReportRepairBarcode(ReportRepairBarcodeEntity);
	return str;
}
/**
* ReportRepairBarcodeEntity List页面
* 
* */
@RequestMapping(value = "/ListPage")
public ModelAndView ReportRepairBarcodeListPage(ReportRepairBarcodeEntity ReportRepairBarcodeEntity,HttpServletRequest request) {
	
	return new ModelAndView(returnPath("ReportRepairBarcodeList"));
}
/**
* ReportRepairBarcodeEntity详细页 
* 
* */
@RequestMapping(value = "/EditPage")
public ModelAndView ReportRepairBarcodeEditPage(ReportRepairBarcodeEntity ReportRepairBarcodeEntity) {
	
	return new ModelAndView(returnPath("ReportRepairBarcodeAdd"));
}
/**
 * 查询ReportRepairBarcodeEntity
 * 
 * */
@RequestMapping(value = "/queryByID")
public @ResponseBody String findReportRepairBarcodeData(HttpServletRequest request) {
	String id = request.getParameter("id");
	ReportRepairBarcodeEntity ReportRepairBarcodeEntity =  ReportRepairBarcodeBizService.queryById(new BigInteger(id));
	return JSON.toJSONString(ReportRepairBarcodeEntity); 
}

/**
 * 保存或更新ReportRepairBarcode 
 * 
 * */
@RequestMapping(value = "/saveReportRepairBarcode")
public @ResponseBody String saveReportRepairBarcodeData(@RequestBody ReportRepairBarcodeEntity ReportRepairBarcodeEntity) {
	ResponseEntity rs = null;
	if(ReportRepairBarcodeEntity!=null){
		ReportRepairBarcodeEntity.setCurrentUser(UserContext.getUser());
		if(ReportRepairBarcodeEntity.getId()!=null){
			rs = ReportRepairBarcodeBizService.updateReportRepairBarcode(ReportRepairBarcodeEntity);
		}else{
			rs = ReportRepairBarcodeBizService.addReportRepairBarcode(ReportRepairBarcodeEntity);
		}
	}
	return JSON.toJSONString(rs);
}
/**
 * 导出ReportRepairBarcodeEntity
 * @author weiwei
 * @date 2015-7-09  下午2:13:28
 * @return
 */
@RequestMapping(value = "/exportReportRepairBarcodeExcel")
public void exportReportRepairBarcodeExcel(ReportRepairBarcodeEntity ReportRepairBarcodeEntity,HttpServletResponse response) {
	ReportRepairBarcodeEntity.setCurrentUser(UserContext.getUser());
	ReportRepairBarcodeBizService.exportReportRepairBarcode(ReportRepairBarcodeEntity, response);
}


 /**
 * 
 * 批量删除
 * @author weiwei
 * @date 2017年3月13日 下午2:48:57
 * @param ReportRepairBarcodeEntity
 * @return
 */
@RequestMapping(value = "/batchDelReportRepairBarcode")
public @ResponseBody String batchDelReportRepairBarcode(ReportRepairBarcodeEntity ReportRepairBarcodeEntity) {
	ResponseEntity rs = null;
	rs = ReportRepairBarcodeBizService.batchDelReportRepairBarcode(ReportRepairBarcodeEntity);
	return  JSON.toJSONString(rs);
}
/**
 * 定义
 * 
 */
private final String MODULE_PATH = "/reportrepairbarcode/";

//返回路径
private String returnPath(String jspName) {
	return MODULE_PATH + jspName;
}
}
